- @title= "งานที่อยู่ระหว่างดำเนินการ"
- @xmains= xmains
%table{:id=>"pending-table", :width=>"100%"}
  %tr{:style=>"color:white; background-color:#97BF60;"}
    %th id
    %th task
    %th step
    %th starter
    %th begin
    %th cancel
  - @xmains.each do |xmain|
    - @xmain= xmain
    - next unless xmain.current_runseq
    - @runseq= Gmindapp::Runseq.find(xmain.current_runseq)
    - next unless @runseq
    - next unless %w(form output pdf).include?(@runseq.action)
    /- debugger
    - next if @xmain.runseqs.first==@xmain.current_runseq && @xmain.gma_user!=current_user
    - next unless authorize?
    %tr
      %td= link_to xmain.id, :controller=>"gmindapp", :action=>"run", :id=>xmain.id
      %td= link_to xmain.name, :controller=>"gmindapp", :action=>"run", :id=>xmain.id
      %td= @runseq.name
      %td{:align=>'center'}= xmain.user ? xmain.user.name : ""
      %td= date_thai xmain.start
      %td{:align=>'center'}= link_to image_tag("delete.png",                          |
        :style=>'border:none; float:none;'),                                          |
        {:controller=>'gmindapp', :action=>'cancel', :id=>xmain.id, :return=>url_for},  |
        :confirm=>"confirm?"                                                          |
